﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 系统设置
{
    public partial class LedSet : Form
    {
        carinfor.equipmentConfigInfdata equipconfig = new carinfor.equipmentConfigInfdata();
        carinfor.configIni configini = new carinfor.configIni();
        public LedSet()
        {
            InitializeComponent();
        }

        private void LedSet_Load(object sender, EventArgs e)
        {

            equipconfig = configini.getEquipConfigIni();
            if (equipconfig.Ledifpz == false)
                comboBoxLEDck.Text = "未配置";
            else
                comboBoxLEDck.Text = equipconfig.Ledck;
            comboBoxLEDXH.Text = equipconfig.Ledxh;
            comboBoxLEDCOMSTRING.Text = equipconfig.LedComstring;
            comboBoxLEDROW1.Text = equipconfig.ledrow1.ToString();
            comboBoxLEDROW2.Text = equipconfig.ledrow2.ToString();
            comboBoxLEDTJPH.Text = equipconfig.LEDTJPH.ToString();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            carinfor.equipmentConfigInfdata equipconfigtosave = new carinfor.equipmentConfigInfdata().CopyFrom(equipconfig);

            if (comboBoxLEDck.Text == "未配置")
                equipconfigtosave.Ledifpz = false;
            else
            {
                equipconfigtosave.Ledifpz = true;
                equipconfigtosave.Ledck = comboBoxLEDck.Text;
            }
            equipconfigtosave.LEDTJPH = int.Parse(comboBoxLEDTJPH.Text);
            equipconfigtosave.ledrow1 = int.Parse(comboBoxLEDROW1.Text);
            equipconfigtosave.ledrow2 = int.Parse(comboBoxLEDROW2.Text);
            equipconfigtosave.Ledxh = comboBoxLEDXH.Text;
            equipconfigtosave.LedComstring = comboBoxLEDCOMSTRING.Text;
            settingform.saveLog("检测配置参数", equipconfig, equipconfigtosave);
            if (configini.writeEquipmentConfig(equipconfigtosave))
                MessageBox.Show("保存成功.", "系统提示");
            else
                MessageBox.Show("数据输入有误,请检查.", "未成功保存");
        }
    }
}
